import Vue from 'vue';
import Vuex from 'vuex';
Vue.use(Vuex);
export const store = new Vuex.Store({
    state:{
        name:"xixi",
        userData:{name:'123'},
        userisLogin:false,
        carList:[],
    },
    mutations:{
        changeUserData:function(state,newData){
            this.state.userData = newData
        },
        changeUserIsLogin:function(state,newDate) {
            this.state.userisLogin = newDate
        },
        addCarList:function(state,newData) {
            const newList = state.carList;
            newList.push(newData);
            state.carList = newList;
        }
    },
    getters:{
        getUserData() {
            return state.userData
        },
        getUserIsLogin() {
            return state.userisLogin
        }
    }
})